package com.lxh.builder;

/**
 * 建造者模式
 */
public class Main {
    public static void main(String[] args) {
        CarBuilder carBuilder = new BenzBuilder();
        Director director = new Director();
        director.setCarBuilder(carBuilder);
        for (int i = 0; i < 3; i++) {
            carBuilder.getCarModel().run();
        }

        carBuilder = new BWMBuilder();
        director.setCarBuilder(carBuilder);
        for (int i = 0; i < 5; i++) {
            carBuilder.getCarModel().run();
        }
    }
}
